package com.splic.product.service.impl;

import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.Page;
import com.splic.common.core.DeviceContext;
import com.splic.common.enums.GoodsCycleEnum;
import com.splic.common.enums.OrderStatusEnum;
import com.splic.common.exception.BusinessException;
import com.splic.common.utils.DateUtils;
import com.splic.common.utils.RandomCodeUtil;
import com.splic.common.utils.SpringBeansUtil;
import com.splic.common.utils.StringUtils;
import com.splic.product.domain.*;
import com.splic.product.dto.*;
import com.splic.product.mapper.OrderMapper;
import com.splic.product.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 订单Service业务层处理
 * 
 * @author singe
 * @date 2022-01-04
 */
@Service
@Slf4j
public class OrderStatisServiceImpl implements OrderStatisService
{
    @Autowired
    private OrderMapper orderMapper;


    @Override
    public List<OrderStatisDto> selectStatisPageList(OrderStatisDto orderStatisDto) {
        Date date = DateUtils.addDays(DateUtils.parseDate(orderStatisDto.getEndCreateTime()), 1);
        orderStatisDto.setEndCreateTime(DateUtil.formatDate(date));
        return orderMapper.selectStatisPageList(orderStatisDto);
    }

    @Override
    public List<OrderScaleDto> selectStatisList(OrderScaleDto orderScaleDto) {
        Date date = DateUtils.addDays(DateUtils.parseDate(orderScaleDto.getEndCreateTime()), 1);
        orderScaleDto.setEndCreateTime(DateUtil.formatDate(date));
        return orderMapper.selectStatisList(orderScaleDto);
    }
}
